package com.roc.web.action.settlemorg;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class AccountBalanceActionSearchCondition extends BaseSearchCondition{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4417512059762563631L;
	private String currentDate;
	private String org;
	private String account;
	private String status;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(currentDate)){
			filedBeanList.add(new WhereHQLFieldBean("s.today_date",currentDate.trim(),"=",false));
		}
		
		if(Constance.isNotEmpty(org)){
			filedBeanList.add(new WhereHQLFieldBean("s.ins_id_cd", org.trim(),"=", false));
		}
		if(Constance.isNotEmpty(account)){
			filedBeanList.add(new WhereHQLFieldBean("s.account_id", account.trim(),"=", false));
		}
		if(Constance.isNotEmpty(status)){
			filedBeanList.add(new WhereHQLFieldBean("s.status", status.trim(),"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select count(*) from apstfr.tbl_ins_id_total_balance s,apstfr.tbl_pos_whilte_list t where s.ins_id_cd=t.whilte_num and t.whilte_type='ins' ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select s.today_date,s.ins_id_cd,t.whilte_name,s.account_id,s.current_amt,s.last_trans_dt,s.last_trans_tm,s.last_key_rsp,s.last_trans_amt,s.status from apstfr.tbl_ins_id_total_balance s,apstfr.tbl_pos_whilte_list t where s.ins_id_cd=t.whilte_num and t.whilte_type='ins' ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return "order by s.today_date desc";
	}

	public String getCurrentDate() {
		return currentDate;
	}

	public void setCurrentDate(String currentDate) {
		this.currentDate = currentDate;
	}

	public String getOrg() {
		return org;
	}

	public void setOrg(String org) {
		this.org = org;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	
}
